/**
 * 
 */
package com.sogeti.mentormatch.aop;

import javax.naming.AuthenticationException;

import com.sogeti.mentormatch.MentorMatchException;
import com.sogeti.mentormatch.data.User;

/**
 * @author Matthew L. Maurer <matthew.maurer@us.sogeti.com>
 */
public interface AuthenticationManager
{
    /**
     * Returns a user object if the user has the correct authentication
     * credentials. Otherwise an exception is thrown.
     * 
     * @param username
     *                The username to attempt authentication for
     * @param password
     *                The password for the username attempting authentication.
     * @return A User if one was found based off the passed in credentials.
     */
    public User login ( String username, String password )
            throws AuthenticationException;

    /**
     * Logout user.
     * 
     * @param user
     *                The logged in user to logout.
     */
    public void logout ( User user ) throws MentorMatchException;

    /**
     * Sets the UserManager that this AuthenticationManager should use for
     * retrieving user information.
     * 
     * @param userManagerToSet
     *                A UserManager object to use for user tasks.
     */
    public void setUserManager ( UserManager userManagerToSet );
}
